<!DOCTYPE html>
<html>
<head>
  <title>直接打开PDF</title>
  <!-- 使用PDF.js的CDN -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script>
  <style>
    body { margin: 0; padding: 20px; }
    #pdf-container { width: 100%; max-width: 800px; margin: 0 auto; }
    canvas { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
  </style>
</head>
<body>
  <div id="pdf-container"></div>

  <script>
    // 固定加载同目录下的PDF文件（修改此处文件名）
    const pdfFileName = 'ddd.pdf'; // 🚨 改为你的PDF文件名

    // 初始化PDF渲染
    const container = document.getElementById('pdf-container');
    pdfjsLib.getDocument(pdfFileName).promise.then(pdf => {
      // 仅渲染第一页（如需全部页面可扩展）
      pdf.getPage(1).then(page => {
        const scale = 1.5;
        const viewport = page.getViewport({ scale });
        const canvas = document.createElement('canvas');
        const ctx = canvas.getContext('2d');
        
        canvas.height = viewport.height;
        canvas.width = viewport.width;
        container.appendChild(canvas);
        
        page.render({
          canvasContext: ctx,
          viewport: viewport
        });
      });
    }).catch(err => {
      container.innerHTML = `<p style="color: red">错误：无法加载PDF文件（${err.message}）</p>`;
    });
  </script>
</body>
</html>